package com.dave.admin.modular.boss.controller;

import com.dave.admin.common.result.CommonResult;
import com.dave.admin.modular.boss.service.OssService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * Oss相关操作接口
 * 后续换成7牛云
 *
 * @author Dave
 */
@RestController
@AllArgsConstructor
@RequestMapping("/boss/oss")
public class OssController {

    private final OssService ossService;

    /**
     * 文件上传
     * 前端上传组件：file_data_name 默认file名称
     */
    @RequestMapping(value = "/fileUp", method = RequestMethod.POST)
    @ResponseBody
    public CommonResult fileUp(@RequestParam(name = "file") MultipartFile multipartFiles) {
        return CommonResult.success(ossService.fileUp(multipartFiles));
    }

}
